package com.paranoid.flashcard.logic;

import com.paranoid.flashcard.model.Deck;
import com.paranoid.flashcard.model.Card;
import com.paranoid.flashcard.model.Card.Side;

public class FirstToLastSequence {
	private Deck deck;
	private int currentCardIndex;
	private Card mActiveCard;
	
	public FirstToLastSequence(Deck deck) {
		this.deck = deck;
		currentCardIndex = -1;
	}
	
	public FlashCardViewModel getNext() {
		currentCardIndex++;
		if (currentCardIndex == deck.size())
			currentCardIndex = 0;

		mActiveCard = deck.getFlashCardByPosition(currentCardIndex);
		FlashCardViewModel result = new FlashCardViewModel(mActiveCard, Side.A);
		
		return result;
	}
	
	protected Card getActiveCard() {
		return mActiveCard;
	}
}
